package com.thingsgrid.appmanager.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.thingsgrid.appmanager.entity.ApplicationInfo;
import feign.Param;

import java.util.List;

public interface IApplicationsMapper extends BaseMapper<ApplicationInfo> {
	/**
	 * 展示所有app
	 *
	 * @return
	 */
	List<ApplicationInfo> showApp();

	/**
	 * 根据设备id查询 设备-应用表 找到应用id，在应用表里找出所有应用
	 *
	 * @param device_id
	 * @return
	 */
	List<ApplicationInfo> getApplications(String device_id);

	/**
	 * 获取最新version
	 * @param id
	 * @return
	 */
	Float getNewVersion(String id);

	List<ApplicationInfo> getAppByDevice_1(@Param("page") Page<ApplicationInfo> page, @Param("device_id") String device_id, @Param("version") Float version);
	List<ApplicationInfo> getAppByDevice_2(@Param("page") Page<ApplicationInfo> page, @Param("device_id") String device_id, @Param("app_version") Float app_version, @Param("app_name") String app_name);

	int getAppcount(String device_id);

	List<ApplicationInfo> getApp(String app_name, Float version, String device_id);

	Page getApppage(Page page, String app_name, Float version, String device_id);

}
